]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
loginDialog: Ensure old timed login timeout is removed before starting a new one
authorverdre <gitlab@v0yd.nl>
Tue, 17 Apr 2018 12:51:20 +0000 (14:51 +0200)
committerverdre <gitlab@v0yd.nl>
Thu, 19 Apr 2018 07:08:45 +0000 (09:08 +0200)
Normally, we give the user a 5 second grace period of inactivity before
starting a timed login operation. Unfortunately, that grace period
timeout isn't properly removed if the timed login operation is restarted
during the grace period. That means the timeout handler can
inadvertently get called multiple times leading to the grace period
duration getting subtracted from the total animation time more than
once.

This commit ensures we only ever have one grace period timeout scheduled
at a time.

js/gdm/loginDialog.js

index dc5eaa2354f07d338915a6a0fabe123ad8bde86a..0179476895dfd74837f03a4b5e2e04e10b618b33 100644 (file)
@@ -1010,6 +1010,7 @@ var LoginDialog = new Lang.Class({
         this._timedLoginIdleTimeOutId = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, _TIMED_LOGIN_IDLE_THRESHOLD,
             () => {
                 this._timedLoginAnimationTime -= _TIMED_LOGIN_IDLE_THRESHOLD;
+                this._timedLoginIdleTimeOutId = 0;
                 hold.release();
                 return GLib.SOURCE_REMOVE;
             });
@@ -1024,6 +1025,12 @@ var LoginDialog = new Lang.Class({
             this._timedLoginBatch = null;
         }
 
+        // Reset previous idle-timeout
+        if (this._timedLoginIdleTimeOutId) {
+            GLib.source_remove(this._timedLoginIdleTimeOutId);
+            this._timedLoginIdleTimeOutId = 0;
+        }
+
         this._timedLoginItem = null;
         this._timedLoginDelay = delay;
         this._timedLoginAnimationTime = delay;